Skip to content

查询路径是否受保护 - ProtectFileQueryProtectedPath

函数简介

查询路径是否受保护。(高级版功能,普通版无法使用)

接口名称

ProtectFileQueryProtectedPath

DLL调用

c
int32_t ProtectFileQueryProtectedPath(int64_t instance, string path, int32_t* mode);

参数说明

参数名类型说明
instance长整数型OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。
path字符串要查询的文件或文件夹路径。
mode整数型指针输出参数,用于接收该路径的保护模式(可为NULL)。

示例

SDK 调用

cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
int ret = ola.ProtectFileQueryProtectedPath("C:\\test.txt", "value");
csharp
using OLAPlug;

var ola = new OLAPlugServer();
int ret = ola.ProtectFileQueryProtectedPath("C:\\test.txt", "value");
python
from OLAPlugServer import OLAPlugServer

ola = OLAPlugServer()
ret = ola.ProtectFileQueryProtectedPath("C:\\test.txt", "value")
java
import com.olaplug.OLAPlugServer;

OLAPlugServer ola = new OLAPlugServer();
int ret = ola.ProtectFileQueryProtectedPath("C:\\test.txt", "value");
go
import "github.com/ola/olaplug/olaplug"

ola, _ := olaplug.NewOLAPlugServer("OLAPlug_x64.dll")
defer ola.ReleaseObj()
ret := ola.ProtectFileQueryProtectedPath("C:\\test.txt", "value")
rust
use olaplug::OLAPlugServer;

let ola = OLAPlugServer::new("OLAPlug_x64.dll").unwrap();
let ret = ola.protect_file_query_protected_path("C:\\test.txt", "value");
cpp
var ola = com("OlaPlug.OlaSoft")
var ret = ola.ProtectFileQueryProtectedPath("C:\\test.txt", "value")
vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
ret = ola.ProtectFileQueryProtectedPath("C:\\test.txt", "value")
text
.局部变量 ola, OLAPlug
ola.创建 ()
ret = ola.ProtectFileQueryProtectedPath(“C:\\test.txt”, “value”)
aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var ret = ola.ProtectFileQueryProtectedPath("C:\\test.txt", "value");
text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
整数 ret = ola.ProtectFileQueryProtectedPath("C:\\test.txt", "value")
cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
int32_t ret = ola.ProtectFileQueryProtectedPath("C:\\test.txt", "value");

原生 DLL 调用

cpp
ProtectFileQueryProtectedPath(instance, "C:\\test.txt", 0);
csharp
using System.Runtime.InteropServices;
using System.Text;

[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int ProtectFileQueryProtectedPath(long ola, string path, int mode);

ProtectFileQueryProtectedPath(instance, "C:\\test.txt", 0);
python
from ctypes import CDLL, c_int, c_int64, create_string_buffer

ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
ola.ProtectFileQueryProtectedPath(instance, "C:\\test.txt", 0)

返回值

本接口为查询类:通讯成功时用 1/0 表示业务结果;仅驱动通讯失败时返回错误码。

错误码去哪里读

方式说明
本接口返回值 retret != 0 && ret != 1 时,ret 即为错误码。
GetLastError / GetLastError()读取最后一次错误码。
GetLastErrorString读取中文说明;用完后须 FreeStringPtr 释放。
驱动错误码说明 - DriverErrorCodes十进制 / 十六进制完整对照表
返回值说明
1查询成功,结果为「是」(在名单中 / 路径受保护)。
0查询成功,结果为「否」;或参数无效。
其他驱动通讯失败时的错误码,见上方「错误码去哪里读」。

TIP

仅当 ret 既不是 0 也不是 1 时,才按驱动错误码表排查。

注意事项

项目说明
管理员权限须以 管理员权限 运行;内置欧拉驱动会自动加载,无需手动 LoadDriver。自签名驱动需先 ImportDriverFromFile 或 ImportDriver。
mode 参数可为NULLmode 参数可为NULL,如果不需要获取保护模式。